<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>代码实现</title>
</head>

<body>
    <input type="text" value="手机" style="color:#999">
    <script>
        var text = document.querySelector('input');
        text.onfocus = function() {
            if (this.value === '手机') {}
            this.style.color = '#333';
        };
    </script>
</body>

</html>